var middlewares   = require('koa-middlewares');
var _             = require('underscore');
var config        = require('./config');
var router = middlewares.router();

module.exports = function (render) {
  router.get('/', function *(next) {
    var index = yield render('index', {});
    this.body = yield render('layout', {  body: index });
  });
  router.get('/home', function *(next) {
    this.request.query = config.planStatus.indexOf(this.request.query.tab)>-1?this.request.query:{tab:config.planStatus[0]}
    var args = {tab:this.request.query.tab};
    var index = yield render('home', args);//underway  / forplaning / finished / archived
    this.body = yield render('layout', {  body: index });
  });
  return router;
};
